<div class="path">
    <i class="iconfont icon-shouye1"></i>
    <a href="{url('admin/default/welcome')}">开始</a> / 
    <a href="javascript:void(0);">库存管理</a>
</div>
<div class="table-search fn-clear">
    <div class="fn-l">
    <form name="search" id="search" action="{url('house/index',array('types'=>$types))}" method="post">
    <select class="select" name="place_id">
        <option value=" ">选择库位</option>
    {loop $place_list $vo} 
        <option value="{$vo['id']}" {if $place_id == $vo['id']} selected="selected"{/if}>{$vo['name']}</option>
    {/loop}
    </select>
    <select class="select" name="manufacturer_id" datatype="*">
        <option value="">厂商</option>
    {loop $manufacturer_lists $vo} 
        <option value="{$vo['id']}" {if $manufacturer_id == $vo['id']} selected="selected"{/if}>{$vo['name']}</option>
    {/loop}
    </select>
      <select class="select" name="producttype_id" datatype="*">
          <option value="">产品名称</option>
      {loop $producttype_lists $vo} 
          <option value="{$vo['id']}" {if $producttype_id == $vo['id']} selected="selected"{/if}>{$vo['name']}</option>
      {/loop}
      </select>
      物料代码: <input class="input w100" datatype="*" type="text" name="code" value="{$code}" />
      物料名称: <input class="input w100" datatype="*" type="text" name="name" value="{$name}" />
      <input type="submit" value="查找" class="button" />
    </form>
    </div>  
</div>
<div class="table-head fn-clear"> 
    <div class="fn-l">
        <a href="{url('house/index',array('types'=>"0"))}" class="button button-green ">
            <i class="iconfont icon-liebiao"></i> 全部物料
        </a>
        <a href="{url('house/index',array('types'=>"1"))}" class="button button-violet ">
            <i class="iconfont icon-liebiao"></i> 物料不足警告
        </a>
    </div>
    <div class="fn-r">
        <a href="{url('house/excel',$search)}" class="button button-violet ">
            <i class="iconfont icon-xiazai"></i> 导出库存表
        </a>
    </div>
</div>
<div class="m10">
<table class="table table-border">
<thead>
    <tr>
        <th class="fn-tac w60">#</th>
        <th class="w200">产品名称</th>
        <th class="w150 fn-tac">物料代码</th>
        <th class="w200">物料名称</th>
        <th>规格型号</th>
        <th class="w80 fn-tac">库存</th>
        <th class="fn-tac w120">更新时间</th>
        <th class="fn-tac w100">操作</th>
    </tr>
</thead>
<tbody>
{loop $list $vo}
{if $types}
    <?php $warning = intval($vo['warning']/4);?>
    {if $vo['amount'] <= $warning}
        <tr>
            <td class="fn-tac">{$vo['id']}</td>
            <td>{$vo['product']}</td>
            <td class="fn-tac">{$vo['code']}</td>
            <td>{$vo['name']}</td>
            <td>{$vo['parameter']}</td>
            <td class="fn-tac"><span class="badge {if $vo['amount'] <= $warning}bg-red{else}bg-blue{/if}">{intval($vo['amount'])}</span></td>
            <td class="fn-tac">{date('Y-m-d',$vo['uptime'])}</td>
            <td class="fn-tac tip">
            {if $vo['types']}
                <a class="win" title="入库" href="javascript:void()" url="{url('house/up',array(id=>$vo['id']))}">入库</a> / 
                <a class="win" title="出库" href="javascript:void()" url="{url('house/down',array(id=>$vo['id']))}">出库</a>
            {else}
                <span class="gray">禁止</span>
            {/if}
            </td>
        </tr>
    {/if}
{else}
    <tr>
        <td class="fn-tac">{$vo['id']}</td>
        <td>{$vo['product']}</td>
        <td class="fn-tac">{$vo['code']}</td>
        <td>{$vo['name']}</td>
        <td>{$vo['parameter']}</td>
        <td class="fn-tac"><span class="badge {if $vo['amount'] <= $warning}bg-red{else}bg-blue{/if}">{intval($vo['amount'])}</span></td>
        <td class="fn-tac">{date('Y-m-d',$vo['uptime'])}</td>
        <td class="fn-tac tip">
            {if $vo['types']}
                <a class="win" title="入库" href="javascript:void()" url="{url('house/up',array(id=>$vo['id']))}">入库</a> / 
                <a class="win" title="出库" href="javascript:void()" url="{url('house/down',array(id=>$vo['id']))}">出库</a>
            {else}
                <span class="gray">禁止</span>
            {/if}
        </td>
    </tr>
{/if}
{/loop}
</tbody>
</table>
<div id="page" class="fn-clear">{$pager}</div>
</div>
<script type="text/javascript">
Do('base','dialog',function(){
  $('.del').click(function(){$(this).del();});
  $('.win').click(function(){$(this).win();});
})
</script>
